<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>美女图片 MN606.COM</title>
    <!-- jQuery -->
    <script type="text/javascript" src="../static/jquery/2.2.4/jquery.min.js"></script>
    <script type="text/javascript" src="../static/js/pop-ico.js"></script>

</head>
<body>
<div class="navbar-right btns" id="displayUser">
    <li class="dropdown changeLogin">
        <a class="btn btn-default navbar-btn sign-in" data-sign="signin" href="#sign-modal" data-toggle="modal"
           id="loginJump" value="123">登录</a>
        <a class="btn btn-default navbar-btn sign-up" data-sign="signup" href="#sign-modal" data-toggle="modal"
           id="registerJump">注册</a>
    </li>
</div>



<div>
    <div style="position: relative;border: 5px solid lightblue;width: 150px;height:150px;margin: 5px auto;border-radius: 50%;">
        <img src="/static/images/default.jpg" alt="选择并上传头像" id="avatar_img"
             style="width: 140px;height: 140px;left:0;top: 0;border-radius: 50%;"/>
        <input type="file" id="avatar_file" name="avatar_file"
               accept="image/jpg,image/png,image/gif"
               style="width: 100%;height:100%;opacity: 0;position: absolute;left:0;top: 0;"/>
    </div>
    <br/>
</div>
</body>
</html>

<script>
    // 头像预览
    $("#avatar_file").change(function () {
        // 获取上传文件对象
        var file = $(this)[0].files[0];
        // 读取文件URL
        var reader = new FileReader();
        reader.readAsDataURL(file);
        // 阅读文件完成后触发的事件
        reader.onload = function () {
            // 读取的URL结果：this.result
            $("#avatar_img").attr("src", this.result);
        }
    });
</script>
